<template>
	<view :class="themeStyle">
		<view class="container">
			<view class="member-container">
				<view class="user-section ns-gradient-pages-member-index-index" :class="themeStyle">
					<view class="bg-img"><image :src="$util.img('upload/uniapp/member/index/bg-2.png')" mode=""></image></view>
					<view class="user-section-box">
						<view class="user-info-box" v-if="token">
							<navigator hover-class="none" url="/otherpages/member/info/info" class="user-head">
								<image
									:src="memberInfo.headimg ? $util.img(memberInfo.headimg) : $util.getDefaultImage().default_headimg"
									mode="aspectFill"
									@error="memberInfo.headimg = $util.getDefaultImage().default_headimg"
								></image>
							</navigator>
							<view class="user-box">
								<text class="user-title">{{ memberInfo.nickname }}</text>
								<view class="">
									<navigator hover-class="none" v-if="memberInfo.member_level_name" url="/otherpages/member/level/level" class="user-label">
										{{ memberInfo.member_level_name }}
									</navigator>
								</view>
							</view>
							<view class="user-box1" v-if="memberInfo.member_type == 2">
								<text>邀请码:</text>
								<text class="invite" @click="copyInviteCode">{{ memberInfo.invite_code }}</text>
							</view>
						</view>
						<view class="user-info-box no-log" v-if="!token" @click="redirectToLink('/pages/member/index/index')">
							<view class="user-head"><image :src="$util.getDefaultImage().default_headimg"></image></view>
							<view class="user-box">
								<text class="user-title">{{ $lang('login') }}</text>
								<text class="user-desc">{{ $lang('loginTpis') }}</text>
							</view>
						</view>
						<navigator hover-class="none" class="user-set" url="/otherpages/member/info/info" v-if="token"><view class="iconfont iconshezhi"></view></navigator>
						<view class="member-sction">
							<view class="sction-item" @click="redirectToLink('/otherpages/member/balance/balance')">
								<text class="num">{{ (parseFloat(memberInfo.balance) + parseFloat(memberInfo.balance_money)).toFixed(2) }}</text>
								<text class="sction-item-name">{{ $lang('balance') }}</text>
							</view>
							<view class="line"></view>
							<view class="sction-item" @click="redirectToLink('/otherpages/member/point/point')">
								<text class="num">{{ parseInt(memberInfo.point) }}</text>
								<text class="sction-item-name">{{ $lang('point') }}</text>
							</view>
							<view class="line"></view>
							<view class="sction-item" @click="redirectToLink('/otherpages/member/coupon/coupon')">
								<text class="num">{{ couponNum }}</text>
								<text class="sction-item-name">{{ $lang('coupon') }}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="member-body">
					<!-- 订单模块 -->
					<view class="order-section">
						<view class="order-head" @click="redirectToLink('/promotionpages/order/list/list')">
							<text class="order-tit">{{ $lang('allOrders') }}</text>
							<text class="order-tip">{{ $lang('seeAllOrders') }}</text>
							<text class="order-more iconfont iconright"></text>
						</view>
						<view class="order-body">
							<view class="order-item" @click="redirectToLink('/promotionpages/order/list/list?status=waitpay')">
								<view class="order-icon">
									<text v-if="orderNum.waitPay > 99" class="order-num ns-bg-color">99+</text>
									<text v-else-if="orderNum.waitPay > 0" class="order-num ns-bg-color">{{ orderNum.waitPay }}</text>
									<image :src="$util.img('upload/uniapp/member/index/order_1.png')" mode=""></image>
								</view>
								<text class="order-name">{{ $lang('waitPay') }}</text>
							</view>
							<view class="order-item" @click="redirectToLink('/promotionpages/order/list/list?status=waitsend')">
								<view class="order-icon">
									<text v-if="orderNum.readyDelivery > 99" class="order-num ns-bg-color">99+</text>
									<text v-else-if="orderNum.readyDelivery > 0" class="order-num ns-bg-color">{{ orderNum.readyDelivery }}</text>
									<image :src="$util.img('upload/uniapp/member/index/order_2.png')" mode=""></image>
								</view>
								<text class="order-name">{{ $lang('readyDelivery') }}</text>
							</view>
							<view class="order-item" @click="redirectToLink('/promotionpages/order/list/list?status=waitpickup')">
								<view class="order-icon">
									<text v-if="orderNum.waitpickup > 99" class="order-num ns-bg-color">99+</text>
									<text v-else-if="orderNum.waitpickup > 0" class="order-num ns-bg-color">{{ orderNum.waitpickup }}</text>
									<image :src="$util.img('upload/uniapp/member/index/order_1.png')" mode=""></image>
								</view>
								<text class="order-name">{{ $lang('waitPickup') }}</text>
							</view>
							<view class="order-item" @click="redirectToLink('/promotionpages/order/list/list?status=waitconfirm')">
								<view class="order-icon">
									<text v-if="orderNum.waitDelivery > 99" class="order-num ns-bg-color">99+</text>
									<text v-else-if="orderNum.waitDelivery > 0" class="order-num ns-bg-color">{{ orderNum.waitDelivery }}</text>
									<image :src="$util.img('upload/uniapp/member/index/order_3.png')" mode=""></image>
								</view>
								<text class="order-name">{{ $lang('waitDelivery') }}</text>
							</view>
							<view class="order-item" @click="redirectToLink('/promotionpages/order/list/list?status=waitrate')">
								<view class="order-icon">
									<text v-if="orderNum.waitEvaluate > 99" class="order-num ns-bg-color">99+</text>
									<text v-else-if="orderNum.waitEvaluate > 0" class="order-num ns-bg-color">{{ orderNum.waitEvaluate }}</text>
									<image :src="$util.img('upload/uniapp/member/index/order_4.png')" mode=""></image>
								</view>
								<text class="order-name">{{ $lang('waitEvaluate') }}</text>
							</view>
							<view class="order-item" @click="redirectToLink('/promotionpages/order/activist/activist')">
								<view class="order-icon">
									<text v-if="orderNum.refunding > 99" class="order-num ns-bg-color">99+</text>
									<text v-else-if="orderNum.refunding > 0" class="order-num ns-bg-color">{{ orderNum.refunding }}</text>
									<image :src="$util.img('upload/uniapp/member/index/order_5.png')" mode=""></image>
								</view>
								<text class="order-name">{{ $lang('refunding') }}</text>
							</view>
						</view>
					</view>

					<view class="member-level" @click="jumpLevel()">
						<view class="member"><image :src="$util.img('upload/uniapp/member/index/member.png')" mode=""></image></view>
						<view class="member-level-box">
							<view class="img-wrap">
								<image class="img-v" :src="$util.img('upload/uniapp/member/index/v.png')" mode=""></image>
								<text class="ns-font-size-base" v-if="token">{{ memberInfo.member_level_name }}</text>
								<text class="ns-font-size-sm" v-else>登录查看权益</text>
							</view>
							<text class="memeber-tit">
								<text class="member-title">会员等级更多权益</text>
								<text class="iconfont iconright ns-font-size-sm"></text>
							</text>
						</view>
					</view>
					<!-- 天天拼团模块 -->
					
					<view class="pintuan-example-body"  v-show="pintuanTraderDetail !== null">
						<view class="example-body-head"><text class="example-tit">团长批发</text></view>
						<view class="pintuan-example-body-content">
							<!-- 批发竞标 -->
							<view @click="redirectToLink('/promotionpages/platformpintuan/bidding_list/bidding_list')" v-if="pintuanTraderDetail !== null">
									<image class="image"  :src="$util.img('upload/uniapp/member/index/pintuan/pintuan_jinbiao.png')" mode="aspectFill" />
									<text class="text">批发竞标</text>
							</view>
							
							<!-- 我的竞标 -->
							<view @click="redirectToLink('/promotionpages/platformpintuan/enter_list/enter_list')" v-if="pintuanTraderDetail !== null ">
									<image class="image" :src="$util.img('upload/uniapp/member/index/pintuan/pintuan_myjinbiao.png')" mode="aspectFill" />
									<text class="text">我的竞标</text>
							</view>
							
							<!-- 批发管理 -->
							<view @click="redirectToLink('/promotionpages/platformpintuan/pintuan_list/pintuan_list')" v-if="pintuanTraderDetail !== null">
									<image class="image" :src="$util.img('upload/uniapp/member/index/pintuan/pintuan_guanli.png')"  mode="aspectFill" />
									<text class="text">批发管理</text>
							</view>
							
							<!-- 团长订单 -->
							<view @click="redirectToLink('/otherpages/member/pintuanbidding/pintuanbidding')" v-if="pintuanTraderDetail != null">
									<image class="image" :src="$util.img('upload/uniapp/member/index/pintuan/pintuan_order.png')" mode="aspectFill" />
									<text class="text">团长订单</text>
							</view>
							
							<!-- 团长邀请 -->
							<view @click="redirectToLink('/otherpages/member/two_code/two_code')" v-if="isAgent()">
									<image class="image" :src="$util.img('upload/uniapp/member/index/pintuan/pintuan_invite.png')" mode="aspectFill" />
									<text class="text">团长邀请</text>
							</view>
							
							<!-- 拼团商审核 -->
							<view @click="redirectToLink('/otherpages/member/check_list/check_list')" v-if="isHignerAgent()">
									<image class="image" :src="$util.img('upload/uniapp/member/index/pintuan/pintuan_shenhe.png')" mode="aspectFill" />
									<text class="text">审核</text>
							</view>
							<!-- 下级代理商 -->
								<view @click="redirectToLink('/otherpages/member/pingtuanshang/pingtuanlist')" v-if="isAgent()">
										<image class="image" :src="$util.img('upload/uniapp/member/index/pintuan/pintuan_nextangent.png')" mode="aspectFill" />
										<text class="text">下级团长</text>
								</view>
						</view>
					</view>	
					
					
					<!--拼团商申请-->
					<view class="member-level" @click="pingtuanshang()" v-show=" pintuanTraderDetail == null ">
						<view class="member-level-box1">
							<image class="img-wrap" :src="$util.img('upload/uniapp/member/index/pintuan/pintuan.png')" mode=""></image>
						</view>
					</view>
					
					<!--代理商申请-->
					<view class="member-level" @click="redirectToLink('/otherpages/member/dailishang/dailishang')" v-show="isAllowApplyAgent()">
						<view class="member-level-box1">
							<image class="img-wrap" :src="$util.img('upload/uniapp/member/index/pintuan/agent.png')" mode=""></image>
						</view>
					</view>


					
					
					
					<!-- 常用功能模块 -->
					<view class="example-body">
						<view class="example-body-head"><text class="example-tit">常用工具</text></view>
						<uni-grid :column="4" :show-border="false" :square="false">
							<!-- 签到 -->
							<!-- <view @click="redirectToLink('/otherpages/member/signin/signin')" v-if="addonIsExit.membersignin">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/sign.png')" mode="aspectFill" />
									<text class="text">签到</text>
								</uni-grid-item>
							</view> -->
							<!-- 会员充值 -->
							<!-- <view @click="redirectToLink('/otherpages/recharge/list/list')">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/m-recharge.png')" mode="aspectFill" />
									<text class="text">会员充值</text>
								</uni-grid-item>
							</view> -->
							
							<!-- 个人资料 -->
							<view @click="redirectToLink('/otherpages/member/info/info')">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/person.png')" mode="aspectFill" />
									<text class="text">{{ $lang('personInfo') }}</text>
								</uni-grid-item>
							</view>

							<!-- 发现 -->
							<block v-if="Development">
								<view @click="redirectToLink('/otherpages/shop/street/street')">
									<uni-grid-item>
										<image class="image" :src="$util.img('upload/uniapp/member/index/find.png')" mode="aspectFill" />
										<text class="text">发现</text>
									</uni-grid-item>
								</view>
							</block>

							<!-- 地址管理 -->
							<view @click="redirectToLink('/otherpages/member/address/address')">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/address.png')" mode="aspectFill" />
									<text class="text">{{ $lang('receivingAddress') }}</text>
								</uni-grid-item>
							</view>

							<!-- 优惠券 -->
							<view @click="redirectToLink('/otherpages/member/coupon/coupon')">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/discount.png')" mode="aspectFill" />
									<text class="text">{{ $lang('couponList') }}</text>
								</uni-grid-item>
							</view>

							<!-- 我的拼单 -->
							<block v-if="Development">
								<view @click="redirectToLink('/promotionpages/pintuan/my_spell/my_spell')" v-if="addonIsExit.pintuan">
									<uni-grid-item>
										<image class="image" :src="$util.img('upload/uniapp/member/index/store.png')" mode="aspectFill" />
										<text class="text">{{ $lang('mySpellList') }}</text>
									</uni-grid-item>
								</view>
							</block>
							
							<!-- 天天拼团 -->
							<block v-if="Development">
								<view @click="redirectToLink('/promotionpages/platformpintuan/my_spell/my_spell')" v-if="addonIsExit.platformpintuan">
									<uni-grid-item>
										<image class="image" :src="$util.img('upload/uniapp/member/index/store.png')" mode="aspectFill" />
										<text class="text">{{ $lang('platformSpellList') }}</text>
									</uni-grid-item>
								</view>
							</block>

							<!-- 我的礼品 -->
							<block v-if="Development">
								<view @click="redirectToLink('/otherpages/member/gift/gift')" v-if="addonIsExit.gift">
									<uni-grid-item>
										<image class="image" :src="$util.img('upload/uniapp/member/index/gift.png')" mode="aspectFill" />
										<text class="text">{{ $lang('winningRecord') }}</text>
									</uni-grid-item>
								</view>
							</block>

							<!-- 我的收藏 -->
							<view @click="redirectToLink('/otherpages/member/collection/collection')">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/like.png')" mode="aspectFill" />
									<text class="text">{{ $lang('myCollection') }}</text>
								</uni-grid-item>
							</view>

							<!-- 我的足迹 -->
							<view @click="redirectToLink('/otherpages/member/footprint/footprint')">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/toot.png')" mode="aspectFill" />
									<text class="text">{{ $lang('myTracks') }}</text>
								</uni-grid-item>
							</view>

							<!-- 兑换记录 -->
							<block v-if="Development">
								<view @click="redirectToLink('/promotionpages/point/order_list/order_list')" v-if="addonIsExit.pointexchange">
									<uni-grid-item>
										<image class="image" :src="$util.img('upload/uniapp/member/index/point_recond.png')" mode="aspectFill" />
										<text class="text">{{ $lang('exchangeOrder') }}</text>
									</uni-grid-item>
								</view>
							</block>

							<!-- 核销台 -->
							<view v-if="authInfo.is_verifier" @click="redirectToLink('/otherpages/verification/index/index')">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/verification.png')" mode="aspectFill" />
									<text class="text">{{ $lang('verification') }}</text>
								</uni-grid-item>
							</view>

							<!-- 账户 -->
							<block v-if="Development">
								<view @click="redirectToLink('/otherpages/member/account/account')" v-if="addonIsExit.memberwithdraw && withdrawConfig && withdrawConfig.is_use">
									<uni-grid-item>
										<image class="image" :src="$util.img('upload/uniapp/member/index/cash.png')" mode="aspectFill" />
										<text class="text">{{ $lang('accountList') }}</text>
									</uni-grid-item>
								</view>
							</block>
							<!-- 分销中心 -->
							<block v-if="Development">
								<view @click="redirectToLink('/otherpages/fenxiao/index/index')" v-if="addonIsExit.fenxiao && fenxiaoBasicsConfig && fenxiaoBasicsConfig.level > 0">
									<uni-grid-item>
										<image class="image" :src="$util.img('upload/uniapp/member/index/fenxiao.png')" mode="aspectFill" />
										<text class="text">{{ fenxiaoWords.concept + '中心' }}</text>
									</uni-grid-item>
								</view>
							</block>
							
							<!-- v-if="memberInfo.fenxiao_level > 0" -->
							<block v-if="memberInfo.fenxiao_level > 0">
								<view @click="redirectToLink('/otherpages/newfenxiao/index/index')" v-if="addonIsExit.fenxiao && fenxiaoBasicsConfig && fenxiaoBasicsConfig.level > 0">
									<uni-grid-item>
										<image class="image" :src="$util.img('upload/uniapp/member/index/tongmei.png')" mode="aspectFill" />
										<text class="text">同煤买菜</text>
									</uni-grid-item>
								</view>
							</block>
							
							
							<!-- 砍价 -->
							<view @click="redirectToLink('/promotionpages/bargain/my_bargain/my_bargain')" v-if="addonIsExit.bargain">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/menu/'+  themeStyleScore +'_bargain.png')" mode="aspectFill" />
									<text class="text">{{ $lang('myBargain') }}</text>
								</uni-grid-item>
							</view>
							<!-- 砍价 -->
							<view @click="redirectToLink('/otherpages/chat/room/room?siteId=0')" v-if="addonIsExit.servicer">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/menu/'+  themeStyleScore +'_kefu.png')" mode="aspectFill" />
									<text class="text">{{ $lang('Service') }}</text>
								</uni-grid-item>
							</view>
							<!-- 自提点 -->
							<!-- v-if="memberInfo.is_pickpoint == 1" -->
							<view @click="redirectToLink('/promotionpages/order/distribution/distribution_list')" >
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/menu/menu8.png')" mode="aspectFill" />
									<text class="text">自提点</text>
								</uni-grid-item>
							</view>
							
							<view @click="redirectToLink('/otherpages/fanyong/index/index')" v-if="addonIsExit.sharerakeback">
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/menu/fanyong.png')" mode="aspectFill" />
									<text class="text">返佣中心</text>
								</uni-grid-item>
							</view>
							
							<!-- 子账号 -->
							<view @click="redirectToLink('/otherpages/member/bussiness_user/list')"
								v-if="memberInfo.member_type == 2 && memberInfo.business_id ==0 "
							>
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/child_member.png')" mode="aspectFill" />
									<text class="text">子账号</text>
								</uni-grid-item>
							</view>
							<!-- 下属企业 -->
							<view @click="redirectToLink('/otherpages/member/bussiness_user/son_list')"
								v-if="memberInfo.member_type == 2 "
							>
								<uni-grid-item>
									<image class="image" :src="$util.img('upload/uniapp/member/index/enterprise_member.png')" mode="aspectFill" />
									<text class="text">下属企业</text>
								</uni-grid-item>
							</view>
							
						</uni-grid>
					</view>
				</view>
				<nsGoodsRecommend ref="goodrecommend"></nsGoodsRecommend>
				<view class="ns-padding-bottom"><ns-copy-right></ns-copy-right></view>

				<ns-login ref="login"></ns-login>
				<!-- 底部tabBar -->
				<diy-bottom-nav @isBulge="isBulge"></diy-bottom-nav>
				
				<uni-popup ref="new_exclusive" type="center" class="wap-floating">
				 <view class="title">
				  <uni-new-exclusive></uni-new-exclusive>
				  <view class="uni-new-exclusive-close" @click="new_exclusive_close()">
				  	+
				  </view>
				 </view>
				</uni-popup>
				
			</view>
		</view>
		<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
	</view>
</template>

<script>
import uniGrid from '@/components/uni-grid/uni-grid.vue';
import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue';
import diyBottomNav from '@/components/diy-bottom-nav/diy-bottom-nav.vue';
import nsGoodsRecommend from '@/components/ns-goods-recommend/ns-goods-recommend.vue';
import toTop from '@/components/toTop/toTop.vue';
import scroll from '@/common/js/scroll-view.js';
import nsCopyRight from '@/components/ns-copyright/ns-copyright.vue';
import fenxiaoWords from 'common/js/fenxiao-words.js';
import globalConfig from '@/common/js/golbalConfig.js';
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import uniNewExclusive from '@/components/uni-new-exclusive/uni-new-exclusive.vue'

export default {
	components: {
		uniGrid,
		uniGridItem,
		diyBottomNav,
		nsGoodsRecommend,
		toTop,
		nsCopyRight,
		uniPopup,
		uniNewExclusive,
	},
	data() {
		return {
			token: '',
			memberInfo: {
				balance: 0,
				balance_money: 0,
				point: 0
			},
			couponNum: 0,
			orderNum: {
				waitPay: 0, //待付款
				readyDelivery: 0, //待发货
				waitDelivery: 0, //待收货
				waitEvaluate: 0, // 待评价
				refunding: 0 ,// 退款中
				waitpickup: 0, //待提货
			},
			isVerification: true,
			copyrightLoad: 0,
			bottom_info: {},
			authInfo: {
				is_verifier: false
			},

			shopTop: false,
			scrollTop: 0,
			shopConfig: null,
			promoterInfo: null,
			withdrawConfig: null,
			fenxiaoBasicsConfig: null,
			Bulge:false,
			
			is_pintuan_trader:0,// 之前的代码
		
			is_new : false,
			pintuanTraderDetail: null, //拼团商详情,
			red_packet_list:'',
		};
	},
	mixins: [scroll, fenxiaoWords,globalConfig],
	onLoad(data) {
		
	},
	computed:{
		addonIsExit(){
			return this.$store.state.addonIsExit
		} 
	},
	onShow() {
		// 刷新多语言
		this.$langConfig.refresh();
		this.token = uni.getStorageSync('token');

		
		if (uni.getStorageSync('userInfo')) {
			this.memberInfo = uni.getStorageSync('userInfo');
		}

		if (uni.getStorageSync('authInfo')) {
			this.authInfo = uni.getStorageSync('authInfo');
		}

		if (this.token) {
			this.getMemberInfo();
			this.getOrderNum();
			this.getCouponNum();
			this.checkIsVerifier();
			if (this.addonIsExit.memberwithdraw) {
				this.getWithdrawConfig();
			}
			if (this.addonIsExit.fenxiao) {
				this.getFenxiaoBasicsConfig();
			}
		} else {
			this.initInfo();
		}
		this.$forceUpdate();
		
		if(uni.getStorageSync('is_new') && this.addonIsExit.newusercoupon){
			uni.removeStorageSync('is_new')
			this.get_red_packets_list()
		}
		this.get_pintuantrader_detail()
	},
	methods: {
		copyInviteCode() {
			let invite_code = this.memberInfo.invite_code;
			this.$util.copy(invite_code);
		},
		//是否代理商
		isAgent(){
			return this.pintuanTraderDetail && this.pintuanTraderDetail.pintuan_trader_level != 'common';
		},
		//是否高级代理商
		isHignerAgent(){
			return this.pintuanTraderDetail && this.pintuanTraderDetail.pintuan_trader_level != 'common' && this.pintuanTraderDetail.pintuan_trader_level != 'partner';
		},
		//能否申请代理
		isAllowApplyAgent(){
			return this.pintuanTraderDetail && this.pintuanTraderDetail.pintuan_trader_level == 'common' && this.pintuanTraderDetail.superior != 0 && (this.pintuanTraderDetail.superior_pintuan_trader_level == 'district' || this.pintuanTraderDetail.superior_pintuan_trader_level == 'city');
		},
		get_pintuantrader_detail() {
			this.$api.sendRequest({
				url : '/platformpintuan/api/Pintuantrader/detail',
				data: {},
				success: res => {
					if(res.code >= 0){
						if(res.data){
							this.pintuanTraderDetail = res.data;
							this.$forceUpdate();
						}
					}
				},
			})
		},
		new_exclusive_close() {
			this.$refs.new_exclusive.close();
		},
		get_red_packets_list() {
			this.$api.sendRequest({
				url: '/newusercoupon/api/coupon/page',
				data: {
					page: 1,
					page_size: 10,
					status: 0,
				},
				success: res => {
					if (res.code == 0) {
						this.red_packet_list = res.data.list
						if(this.red_packet_list.length > 0) {
							this.$refs.new_exclusive.open();
						}
					} 
				},
			});	
		},
		isBulge(e){
			this.Bulge=e;
		},
		redirectToLink(url) {
			if (!uni.getStorageSync('token')) {
				this.$refs.login.open(url);
			} else {
				this.$util.redirectTo(url);
			}
		},
		initInfo() {
			this.token = '';
			this.memberInfo = {
				balance: '0.00',
				balance_money: '0.00',
				point: 0
			};
			this.couponNum = 0;
			this.orderNum = {
				waitPay: 0, //待付款
				readyDelivery: 0, //待发货
				waitDelivery: 0, //待收货
				waitEvaluate: 0, // 待评价
				refunding: 0 ,// 退款中
				waitpickup: 0,//待提货
			};
			this.authInfo = {
				is_verifier: false
			};
			uni.stopPullDownRefresh();
		},
		// 获取会员基础信息
		async getMemberInfo() {
			let res = await this.$api.sendRequest({
				url: '/api/member/detail',
				async: false
			});
			if (res.code >= 0 && res.data) {
				// console.log(this.memberInfo,'jdkfjkejwkfjwkej');
				this.token = uni.getStorageSync('token');
				this.memberInfo = res.data;
				uni.setStorageSync('userInfo', this.memberInfo);
				//console.log(res);
				// 企业注册is_success
				if(res.data.member_type == 1 ){
					console.log(res);
					if(! res.data.cert_id){
						uni.redirectTo({
						    url: '/pages/login/register/authentication'
						});
					}else{
						if(res.data.check_status!=1){
							uni.redirectTo({
							    url: '/pages/login/register/audit'
							});
						}
					}
				
				}
				//console.log(res.data.cert_id);
			
				
			} else {
				this.token = '';
				this.initInfo();
				uni.removeStorageSync('token');
			}
			uni.stopPullDownRefresh();
		},
		// 下拉刷新
		onPullDownRefresh() {
			if (uni.getStorageSync('token')) this.getMemberInfo();
			else this.initInfo();
		},
		// 订单数量
		getOrderNum() {
			this.$api.sendRequest({
				url: '/api/order/num',
				data: {
					order_status: 'waitpay,waitsend,waitconfirm,waitrate,refunding,waitpickup'
				},
				success: res => {
					if (res.code == 0) {
						this.orderNum.waitPay = res.data.waitpay;
						this.orderNum.readyDelivery = res.data.waitsend;
						this.orderNum.waitDelivery = res.data.waitconfirm;
						this.orderNum.waitEvaluate = res.data.waitrate;
						this.orderNum.refunding = res.data.refunding;
						this.orderNum.waitpickup = res.data.waitpickup;
					}
				}
			});
		},
		// 优惠券数量
		getCouponNum() {
			this.$api.sendRequest({
				url: '/api/member/couponnum',
				success: res => {
					if (res.code == 0) {
						this.couponNum = res.data;
					}
				}
			});
		},
		checkIsVerifier() {
			this.$api.sendRequest({
				url: '/api/verify/checkisverifier',
				success: res => {
					if (res.data) this.authInfo.is_verifier = true;
					else this.authInfo.is_verifier = false;
					uni.setStorageSync('authInfo', this.authInfo);
				}
			});
		},
		jumpLevel() {
			if (this.token) {
				this.$util.redirectTo('/otherpages/member/level/level');
			} else {
				this.$refs.login.open('/pages/member/index/index');
			}
		},
		/**
		 * 获取余额提现配置
		 */
		getWithdrawConfig() {
			this.$api.sendRequest({
				url: '/api/memberwithdraw/config',
				success: res => {
					if (res.code >= 0 && res.data) {
						this.withdrawConfig = res.data;
					}
				}
			});
		},
		/**
		 * 获取分销基本配置
		 */
		getFenxiaoBasicsConfig() {
			this.$api.sendRequest({
				url: '/fenxiao/api/config/basics',
				success: res => {
					if (res.code >= 0) {
						this.fenxiaoBasicsConfig = res.data;
					}
				}
			});
		},
		toLevel(){
			this.$util.r
		},
		
		/**
		 * 拼团商
		 */
		pingtuanshang(){
			this.$util.redirectTo('/otherpages/member/pingtuanshang/pingtuanshang');
		},
		close_new_exclusive() {
		
		console.log(111);
		
			//this.$refs.new_exclusive.close();
		},
	}
};
</script>

<style lang="scss">
@import '../public/css/index.scss';

</style>
<style lang="scss" scoped>
	/deep/ .uni-popup__wrapper-box {
		overflow: hidden;
		border-radius: 0 0 30rpx 30rpx;
	}
</style>
